import { get, post } from '@/utils/http'

enum API {
  // 登录记录
  LOGINLOG_API = '/loginLog/loginLog',
  // 获取登录记录列表
  LOGLIST_API = '/loginLog/loginLogList',
  // 根据账号搜索最近十条登录记录
  SEARCHLOGINLOGLIST_API = '/loginLog/searchloginLogList',
  // 清空登录日志
  CLEARLOGINLOG_API = '/loginLog/clearLoginLog'
}
// 登录记录
export const loginLogAPI = (account: number, name: string, email: string) => {
  return post<void>(API.LOGINLOG_API, { account, name, email })
}

// 获取登录记录列表
export const getLogListAPI = (page: number) => {
  return get<LoginLogList[]>(API.LOGLIST_API, { params: { page } })
}

// 根据账号搜索最近十条登录记录
export const searchloginLogListAPI = (account: number) => {
  return get<void>(API.SEARCHLOGINLOGLIST_API, { params: { account } })
}

// 清空登录日志
export const clearLoginLogAPI = () => {
  return post<void>(API.CLEARLOGINLOG_API)
}
